home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / execd1200.iso / Shareware / Blocks 3 / setup.exe / Source / LEVELS.C < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-06  |  1.8 KB  |  84 lines

  1. #include <allegro.h>
  2. #include <jgmod.h>
  3. #include <blocks3.h>
  4.  
  5. void Change_Levels(void)
  6. {
  7.  int l, i, j, k;
  8.  BITMAP *temp2 = create_bitmap(640, 480);
  9.  
  10.  blit(temp, temp2, 0, 0, 0, 0, 640, 480);
  11.  clear(temp);
  12.  
  13.  l = lev;
  14.  
  15.  Map_to_Maps(100);
  16.  
  17.  while(key[KEY_ESC]);
  18.  while(key[KEY_ENTER]);
  19.  
  20.  while ((!key[KEY_ESC]) && (!key[KEY_ENTER]))
  21.  {
  22.   Maps_to_Map(l);
  23.   Change_Motif(map_motif[l]);
  24.   Draw_Map();
  25.   text_mode(-1);
  26.  
  27.   textprintf(temp, fonts[0].dat, 10, 9, 0, "Level: %d", l + 1);
  28.   textprintf(temp, fonts[0].dat, 11, 9, 0, "Level: %d", l + 1);
  29.   textprintf(temp, fonts[0].dat, 11, 10, 0, "Level: %d", l + 1);
  30.   textprintf(temp, fonts[0].dat, 11, 11, 0, "Level: %d", l + 1);
  31.   textprintf(temp, fonts[0].dat, 10, 11, 0, "Level: %d", l + 1);
  32.   textprintf(temp, fonts[0].dat,  9, 11, 0, "Level: %d", l + 1);
  33.   textprintf(temp, fonts[0].dat,  9, 10, 0, "Level: %d", l + 1);
  34.   textprintf(temp, fonts[0].dat,  9,  9, 0, "Level: %d", l + 1);
  35.  
  36.   textprintf(temp, fonts[0].dat, 10, 10, 7, "Level: %d", l + 1);
  37.  
  38.   blit(temp, screen, 0, 0, 0, 0, 640, 480);
  39.  
  40.   while ((key[KEY_UP]) || (key[KEY_DOWN]) ||
  41.          (key[KEY_LEFT]) || (key[KEY_RIGHT]));
  42.  
  43.   while ((!key[KEY_UP]) && (!key[KEY_DOWN]) &&
  44.          (!key[KEY_LEFT]) && (!key[KEY_RIGHT]) &&
  45.          (!key[KEY_ESC]) && (!key[KEY_ENTER]));
  46.  
  47.   if (key[KEY_ESC])
  48.   {
  49.    Maps_to_Map(100);
  50.    Change_Motif(map_motif[lev]);
  51.  
  52.    for (j = 0; j < 15; j+=2)
  53.    for (i = 0; i < 20; i+=2)
  54.    blit(gfx, back, 0, 200, i*32, j*32, 64, 64);
  55.  
  56.    blit(temp2, temp, 0, 0, 0, 0, 640, 480);
  57.    while(key[KEY_ESC]);
  58.    return;
  59.   }
  60.  
  61.   if (key[KEY_ENTER])
  62.   {
  63.    game_exit = 2;
  64.    lev = l;
  65.    return;
  66.   }
  67.  
  68.   if (key[KEY_LEFT]) l--;
  69.   if (key[KEY_RIGHT]) l++;
  70.   if (key[KEY_UP]) l+=10;
  71.   if (key[KEY_DOWN]) l-=10;
  72.  
  73.   if (l < 0) l+=100;
  74.   if (l > 99) l-=100;
  75.  }
  76.  
  77. exit(66);
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84.